Parallel query engine with dynamic number of workers

ABSTRACT

Partitioning query execution work of a sequence including a plurality of elements. A method includes a worker core requesting work from a work queue. In response, the worker core receives a task from the work queue. The task is a replicable sequence-processing task including two distinct steps: scheduling a copy of the task on the scheduler queue and processing a sequence. The worker core processes the task by: creating a replica of the task and placing the replica of the task on the work queue, and beginning processing the sequence. The acts are repeated for one or more additional worker cores, where receiving a task from the work queue is performed by receiving one or more replicas of tasks placed on the task queue by earlier performances of creating a replica of the task and placing the replica of the task on the work queue by a different worker core.

BACKGROUND Background and Relevant Art

Computers and computing systems have affected nearly every aspect ofmodern living. Computers are generally involved in work, recreation,healthcare, transportation, entertainment, household management, etc.

Recent advances in computing technology include the use of multipleprocessors or cores in a single machine. Often, the multiple cores maybe implemented on the same semiconductor die or at least packaged in thesame chip package. To effectively utilize the multi-core systems,programming techniques have been developed to split computing workbetween the cores. A data-parallel declarative programming model makesit easy for developers to build programs that execute on parallelsystems such as multi-core machines or clusters. A data-paralleloperation will typically split up the input sequence into some number ofpartitions and then process each partition on a single worker (i.e. athread executing on a single core). Developers write programs in adata-parallel declarative programming model by combining operators(filters, projections, aggregations, etc) into queries. It is oftendifficult to determine how many workers should be created, because othercomputations may be happening on the machine at the same time.

In previous solutions, the intermediate data-parallel operation resultsare represented as a set of partitions. Each partition is a sequencethat can be processed independently from other partitions, and thusdifferent partitions can be processed on different computational cores.The input of each query operator is a fixed number of input partitions,and its output is the same fixed number of output partitions. Theoperator will typically wrap each input partition with a particularoperation (e.g., a filtering operator will wrap each partition with afiltering operation, a mapping operator with a mapping operation, etc.)

In this model, the number of parallel workers is fixed for the durationof the data-parallel query evaluation, so computational resources on themachine may not be used optimally. The number of workers is by defaultequal to the number of processors on the machine. If one of theprocessors is busy at the time when the query is initiated, theprocessing of one partition will stall until a processor becomesavailable.

The subject matter claimed herein is not limited to embodiments thatsolve any disadvantages or that operate only in environments such asthose described above. Rather, this background is only provided toillustrate one exemplary technology area where some embodimentsdescribed herein may be practiced.

BRIEF SUMMARY

One embodiment is directed to a method that may be practiced in acomputing environment including multiple processor cores. The methodincludes acts for partitioning query execution work of a sequencecomprising a plurality of elements. The method includes: (a) a workercore requesting work from a work queue; (b) in response, the worker corereceiving a task from the work queue (the task is a replicablesequence-processing task including two distinct steps: scheduling a copyof the task on the scheduler queue and processing a sequence); (c) theworker core processing the task by: creating a replica of the task andplacing the replica of the task on the work queue, and beginningprocessing the sequence. Acts (a)-(c) are repeated for one or moreadditional worker cores. Act (b) for the one or more additional workercores is performed by receiving one or more replicas of tasks placed onthe task queue by an earlier performance of act (c) by a differentworker core.

This Summary is provided to introduce a selection of concepts in asimplified form that are further described below in the DetailedDescription. This Summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used as an aid in determining the scope of the claimed subjectmatter.

Additional features and advantages will be set forth in the descriptionwhich follows, and in part will be obvious from the description, or maybe learned by the practice of the teachings herein. Features andadvantages of the invention may be realized and obtained by means of theinstruments and combinations particularly pointed out in the appendedclaims. Features of the present invention will become more fullyapparent from the following description and appended claims, or may belearned by the practice of the invention as set forth hereinafter.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the manner in which the above-recited and other advantagesand features can be obtained, a more particular description of thesubject matter briefly described above will be rendered by reference tospecific embodiments which are illustrated in the appended drawings.Understanding that these drawings depict only typical embodiments andare not therefore to be considered to be limiting in scope, embodimentswill be described and explained with additional specificity and detailthrough the use of the accompanying drawings in which:

FIG. A1 illustrates processing a lazy sequence in a multi-core system;

FIG. 1B illustrates processing a lazy sequence in a multi-core system;

FIG. 1C illustrates processing a lazy sequence in a multi-core system;

FIG. 2 illustrates a process flow for processing an input in amulti-core system; and

FIG. 3 illustrates a method of processing a sequence of work.

DETAILED DESCRIPTION

Embodiments may be implemented to execute a data-parallel query on adynamic number of worker cores. A core is a piece of processor hardwarethat can run a single thread at any given instant. It may multitask byrunning several different threads, but at any given time, only a singlethread has instructions being executed on the core. A worker thread is asequential part of a program that executes on a single core. A programcan include multiple threads that run concurrently with respect to eachother. A task is a unit of work to be performed. Tasks to be done areheld on a work queue. In the following examples, there are severalthreads whose role it is to pull tasks from the work queue and executethem

The query evaluation begins with a single task that when executed by aworker core, schedules another task for another worker core, and thefirst worker core, as part of the task, begins executing the query. Ifand when another core becomes available, the second worker core executesthe another task and schedules a third task, and helps the first workerexecute the query. This can continue until the query is completed or allpossible worker cores have been scheduled.

Some embodiments described herein include representation of intermediatequery results that allows a dynamic number of workers (threads orcores). A scheme may be implemented for partitioning a single inputstream into a dynamic number of streams. Data-parallel operations can beperformed on a dynamic number of streams. A scheme may be implementedfor merging a dynamic number of streams into a single output stream.

Referring to FIG. 1A, and as used herein, a lazy sequence 114 is asubroutine stored on a computer that represents a sequence where callingthe subroutine the first time computes and returns the first element116-1 of the sequence, calling the subroutine the second time returnsthe second element 116-2 of the sequence, calling the subroutine thei-th time returns the i-th element 116-i of the sequence, etc. Thesubroutine returns a special signal instead of a value if it was calledand there are no more elements in the sequence.

A lazy locked sequence is a lazy sequence protected by a lock, so thatmultiple threads can pull elements from the sequence. When a threadwants to remove an element from a lazy locked sequence, it performsthese steps: acquire the lock on the lazy sequence (if the lock is heldby another thread, wait until the lock is released); call the lazysequence subroutine, and store the element returned; release the lock

Often, it is useful to perform some expensive operation on each elementin a (logical) sequence (that may be represented as a lazy sequence).Performing an expensive operation on each element is referred to hereinas “processing” the sequence. Embodiments are implemented to process thesequence on multiple threads, so that the operation on differentelements is executed on different threads. Furthermore, the embodimentsmay ensure that the number of threads used to process the sequence isautomatically adjusted based on how busy the machine is.

Referring now to FIG. 1A, an example is illustrated. FIG. 1A illustratesgenerally a multi core system 102. Generally an application 104 will usea scheduler 106 to add tasks (referred to herein generally as 110 andspecifically by 110 plus a suffix designator) to a work queue 108. Awork queue is a data structure that stores units of work that need to becompleted (i.e. ‘tasks’). As noted above, an application 104 may addtasks, where each task can be obtained from the queue by a processorcore, such as one of the processor cores 112-1, 112-2, 112-3, or 112-4(which may be referred to herein generally as 112 and specifically bytheir suffix designator) of the multi core system 102. Each of the cores112-1, 112-2, 112-3, or 112-4 can poll the queue 108 to find work whenthe cores 112 are idle or have completed other work. Embodiments hereinmay refer to work threads, where each worker thread runs on onecomputational hardware core 112 and continuously removes tasks 110 fromthe work queue 108 and executes them.

Embodiments may implement a replicable sequence-processing task so thata dynamic number of cores 112 can be assigned to process a sequence asthe cores 112 become available. A replicable sequence-processing task isan efficient way to process a sequence 114 on parallel hardware. Thehardware of the multi core system 102 may also be executing otheroperations. For example, some cores 112 may be processing a sequence 114while other cores a performing other work. A replicablesequence-processing task is used to processes a lazy locked sequence bythe sequence-processing task including two distinct steps: (1)scheduling a copy of itself on the scheduler queue; and (2) beginremoving elements from the lazy locked sequence and processing them asexplained previously in conjunction with the explanation of the lazysequence subroutine.

Illustrating now an example, assume that a first core 112-1 is the onlycore available to process the sequence 114. A task 110-1 is on the workqueue and is a replicable sequence-processing task for processing thelazy sequence 114, such that it includes steps of (1) scheduling a copyof itself on the scheduler queue; and (2) begin removing elements fromthe lazy sequence 114 and processing them. When the first core 112-1polls the work queue 108, the task 110-1 will be discovered. The firstcore 112-1 processing the task 110-1 causes the task 110-1 to bereplicated as illustrated in FIG. 1B creating task 110-2. In particular,FIG. 1B illustrates a task 110-2 which is a replica of task 110-1meaning that it includes steps of (1) scheduling a copy of itself on thescheduler queue; and (2) begin removing elements from the lazy sequence114 and processing them. The first core 112-1 processing the task 110-1also results in the first core 112-1 beginning to process elements ofthe sequence 114 using the subroutine as described above. Thus, if thisis the first use of the sub-routine, the first core 112-1 will beginprocessing element 116-1.

As illustrated in FIG. 1A, the other cores 112-2, 112-3, and 112-4 areeach performing other work and are thus not available to participate inprocessing the sequence 114. However, FIG. 1B illustrates that thesecond core 112-2 may complete processing other work, and as a resultpolls the work queue 108 to discover new work. The second core 112-2discovers the replicable sequence-processing task 110-2, which as notedabove includes steps of (1) scheduling a copy of itself on the schedulerqueue; and (2) begin removing elements from the lazy sequence 114 andprocessing them. The second core 112-2 processing the task 110-2 resultsin the creation of a replica of the task 110-2, illustrated as thereplicable sequence-processing task 110-3 in FIG. 1C, and the secondcore 112-2 beginning to process the lazy sequence 114. In particular,the second core 112-2 will start processing the next element of thesequence after the last element of the sequence removed by the firstcore 112-1. Thus, if the first core is currently processing element116-1, then the second core 112-2 will use the subroutine describedabove resulting the processing of the element 116-2.

As illustrated in FIG. 1C, this process can be repeated as the thirdcore 112-3 becomes idle and thus processes the task 110-3 resulting in areplica of the task 110-3 being added to the work queue 108 and thethird core 112-3 beginning processing of elements on the lazy sequence114. This can be continued until all possible cores are processing thelazy sequence and/or until the lazy sequence 114 has been fullyprocessed, such as by all elements 116 having been processed and thespecial signal being returned. Any remaining replicablesequence-processing task on the work queue 108 can then be removed sothat other tasks from the work queue 108 can be performed.

The results of performing the work by each of the cores 112 involved inprocessing the lazy sequence 114 are then merged to form a final result.

This design facilitates using an appropriate number of threads toprocess the sequence 114 (i.e., perform some computation for everyelement 116 in the sequence 114). If the machine is busy and only asingle core 112 is available in the scheduler, that core will processentire sequence 114. If—on the other hand—more cores 112 becomeavailable while the sequence is getting processed, those cores 112 willjoin the sequence processing (by picking up one of the replica tasks 110from the work queue 108).

Intermediate query results are represented as a partitioned set that candynamically add more partitions at run time. In a typical workscheduler, multiple worker cores pull task descriptions from one or morework queues. Notably, embodiments may be implemented where multiple workqueues 108 can be used the same set of cores to support tasks withdifferent priorities, to group tasks to maximize locality, etc.

Further details and examples are now illustrated using C# code examples.the following is a representation of intermediate query results:

public interface IDynamicPartitions<T> {  IEnumerator<T> GetPartition(); }

An IDynamicPartitions<T> result set can be consumed by a dynamic numberof worker cores. To add another worker core to the execution,GetPartition( ) is called, and the returned IEnumerator<T> is assignedto be consumed by that worker core. This constraint has impact on allparts of the query execution, such as that illustrated in FIG. 2:

1. Partitioning (202): IEnumerable<T>=>IDynamicPartitions<T>

2. Query operator implementation (204):IDynamicPartitions<T>=>IDynamicPartitions<U>3. Merging (206): different variants, an example isIDynamicPartitions<T>=>IEnumerable<T>

Additional details are now illustrated for each of partitioning, queryoperator implementation and merging.

The partitioning act takes one sequence as an input 200, represented forexample as an IEnumerable<T> or an array of T. For example, the array Tmay be the lazy sequence 114. The partitioning act will dynamicallysplit up the sequence into multiple sequences as illustrated atpartition input 202.

In one simple partitioning implementation, whenever a worker core (e.g.a core 112) is ready to process another element (e.g. an element 116),it takes a lock and removes one element from the input sequence.Inasmuch as elements are assigned to partitions on-demand rather thanup-front, worker cores can be easily added throughout the computation.

Alternatively, the worker could remove an entire chunk of elements fromthe source each time it needs more work, thereby reducingsynchronization overhead. For example, when locks are taken lessfrequently, synchronization overhead is reduces.

Query operators are illustrated at 204 in FIG. 2. Differentdata-parallel operators also have to be implemented in a way thatsupports dynamically added worker cores.

For example, a filtering operation 208 would implement GetPartitions( )as follows, in C#:

class FilteredPartitions<T> : IDynamicPartitions<T> {  privateIDynamicPartitions<T> inputPartitions = ...  Func<T, bool> filterFunc =...  public IDynamicPartitions<T> GetPartition( ) {   return newFilterPartition(inputPartitions.GetPartition( ));  }  privateIEnumerator<T> FilterPartition(IEnumerator<T> inPartition) {  while(true) {    bool elementFound = false;    while(elementFound =inPartition.MoveNext( ) && !filterFunc(inPartition.Current)) { }    if(elementFound) { yield return inPartition.Current; }    else { yieldbreak; }   }  } }

Each time FilteredPartitions<T>.GetPartition( ) is called, embodimentscall GetPartitions( ) on the input partition, and wrap the inputpartition with a filter that only keeps results that match the filter.

Merging is illustrated at 206 in FIG. 2. As the last step of thedata-parallel operation illustrated in FIG. 2, Embodiments merge the(dynamic number of) partitions into a single output sequence. The mergewill call GetPartitions( ) to get an IDynamicPartitions<T> object thatrepresents the results of the query. Then, the merge will hand outdifferent partitions to different worker cores. Each worker core willenumerate its own partition, thereby executing its own share of work.

Various merge algorithms are possible. Embodiments are implemented wherethe merge supports dynamically added worker cores. In one simple mergealgorithm that supports dynamically added workers, each worker coresimply pulls elements from its partition, and inserts them into a singlelist as follows:

public static void MergeResults(IDynamicPartitions<T> partitions,List<T> results) {  using(IEnumerator<T> myPartition =partitions.GetPartition( )) {   while(myPartition.MoveNext( )) {    Tresult = myPartition.Current;    lock(results) {    results.Add(result);    }   }  } }The query can be executed in parallel as follows:

public static void RunQuery(IDynamicPartitions<T> partitions) {  List<T>results = new List<T>( );  Task task =TaskScheduler.ScheduleReplicatingTask(   _(—) =>MergeResults(partitions, results);  )  task.Wait( ); // waits for allreplicas to complete  return results; }

This algorithm doesn't guarantee the order of the output elements.However, merge algorithms that do preserve ordering are also possible.

The following discussion now refers to a number of methods and methodacts that may be performed. It should be noted, that although the methodacts may be discussed in a certain order or illustrated in a flow chartas occurring in a particular order, no particular ordering isnecessarily required unless specifically stated, or required because anact is dependent on another act being completed prior to the act beingperformed.

Referring now to FIG. 3, a method 300 is illustrated. The method 300 maybe practiced in a computing environment including multiple processorcores, such as the system 102 illustrated in FIG. 1A. The method 300includes acts for partitioning query execution work of a sequenceincluding a plurality of elements. The method includes a worker corerequesting work from a work queue (act 302). For example, a core 112 mayrequest a task 110 from a work queue 108.

In response to the request, the worker core receives a task from thework queue (act 304). The task is a replicable sequence-processing taskcomprising two distinct steps, including a subtask of scheduling a copyof the task on the scheduler queue and a subtask of processing asequence. The worker core processes the task (act 306). Processing thetask may include creating a replica of the task and placing the replicaof the task on the work queue and beginning processing the sequence. Thereplica of the task is a replicable sequence-processing task comprisingtwo distinct steps, including a subtask of scheduling a copy of thereplica of the task on the scheduler queue and a subtask of processing asequence.

As illustrated in FIG. 3, acts 302-306 are repeated by one or moreadditional worker cores. Act 304 for the one or more additional workercores is performed by receiving one or more replicas of tasks placed onthe task queue by an earlier performance of act 306 by a differentworker core. For example, when the method 300 is performed by processor112-2, it will receive a task 110-2 placed onto the work queue by theprocessor 112-1 as a result of processor 112-1 processing the task110-1.

The method 300 may be practiced where beginning processing the sequenceincludes requesting and processing a single element of the sequence notalready processed or being processed by another worker core. Forexample, only a single element 116 may be processed at a given time by aprocessor. Alternatively, the method 300 may be practiced wherebeginning processing the sequence includes requesting and processing apredetermined number of element of the sequence not already processed orbeing processed by another worker core. For example, multiple elements116 may be processed. This may be done so as to reduce synchronizationoverhead.

The method 300 may be practiced where the sequence is a lazy sequence,or where the sequence is a lazy locked sequence.

Embodiments of the present invention may comprise or utilize a specialpurpose or general-purpose computer including computer hardware, asdiscussed in greater detail below. Embodiments within the scope of thepresent invention also include physical and other computer-readablemedia for carrying or storing computer-executable instructions and/ordata structures. Such computer-readable media can be any available mediathat can be accessed by a general purpose or special purpose computersystem. Computer-readable media that store computer-executableinstructions are physical storage or non-transitory media.Computer-readable media that carry computer-executable instructions aretransmission media. Thus, by way of example, and not limitation,embodiments of the invention can comprise at least two distinctlydifferent kinds of computer-readable media: physical storage media andtransmission media.

Physical storage media includes RAM, ROM, EEPROM, CD-ROM or otheroptical disk storage, magnetic disk storage or other magnetic storagedevices, or any other medium which can be used to store desired programcode means in the form of computer-executable instructions or datastructures and which can be accessed by a general purpose or specialpurpose computer.

A “network” is defined as one or more data links that enable thetransport of electronic data between computer systems and/or modulesand/or other electronic devices. When information is transferred orprovided over a network or another communications connection (eitherhardwired, wireless, or a combination of hardwired or wireless) to acomputer, the computer properly views the connection as a transmissionmedium. Transmissions media can include a network and/or data linkswhich can be used to carry or desired program code means in the form ofcomputer-executable instructions or data structures and which can beaccessed by a general purpose or special purpose computer. Combinationsof the above should also be included within the scope ofcomputer-readable media.

Further, upon reaching various computer system components, program codemeans in the form of computer-executable instructions or data structurescan be transferred automatically from transmission media to physicalstorage media (or vice versa). For example, computer-executableinstructions or data structures received over a network or data link canbe buffered in RAM within a network interface module (e.g., a “NIC”),and then eventually transferred to computer system RAM and/or to lessvolatile physical storage media at a computer system. Thus, it should beunderstood that physical storage media can be included in computersystem components that also (or even primarily) utilize transmissionmedia.

Computer-executable instructions comprise, for example, instructions anddata which cause a general purpose computer, special purpose computer,or special purpose processing device to perform a certain function orgroup of functions. The computer executable instructions may be, forexample, binaries, intermediate format instructions such as assemblylanguage, or even source code. Although the subject matter has beendescribed in language specific to structural features and/ormethodological acts, it is to be understood that the subject matterdefined in the appended claims is not necessarily limited to thedescribed features or acts described above. Rather, the describedfeatures and acts are disclosed as example forms of implementing theclaims.

Those skilled in the art will appreciate that the invention may bepracticed in network computing environments with many types of computersystem configurations, including, personal computers, desktop computers,laptop computers, message processors, hand-held devices, multi-processorsystems, microprocessor-based or programmable consumer electronics,network PCs, minicomputers, mainframe computers, mobile telephones,PDAs, pagers, routers, switches, and the like. The invention may also bepracticed in distributed system environments where local and remotecomputer systems, which are linked (either by hardwired data links,wireless data links, or by a combination of hardwired and wireless datalinks) through a network, both perform tasks. In a distributed systemenvironment, program modules may be located in both local and remotememory storage devices.

The present invention may be embodied in other specific forms withoutdeparting from its spirit or essential characteristics. The describedembodiments are to be considered in all respects only as illustrativeand not restrictive. The scope of the invention is, therefore, indicatedby the appended claims rather than by the foregoing description. Allchanges which come within the meaning and range of equivalency of theclaims are to be embraced within their scope.

1. In a computing environment comprising multiple processor cores amethod of partitioning query execution work of a sequence comprising aplurality of elements, the method comprising: (a) a worker corerequesting work from a work queue; (b) in response, the worker corereceiving a task from the work queue, the task being a replicablesequence-processing task comprising two distinct steps, including asubtask of scheduling a copy of the task on the scheduler queue and asubtask of processing a sequence; (c) the worker core processing thetask by: creating a replica of the task and placing the replica of thetask on the work queue, wherein the replica of the task is a replicablesequence-processing task comprising two distinct steps, including asubtask of scheduling a copy of the replica of the task on the schedulerqueue and a subtask of processing a sequence; and beginning processingthe sequence; and (d) repeating acts (a)-(c) for one or more additionalworker cores, wherein act (b) for the one or more additional workercores is performed by receiving one or more replicas of tasks placed onthe task queue by earlier performance of act (c) by one or moredifferent worker cores.
 2. The method of claim 1, wherein beginningprocessing the sequence comprises requesting and processing a singleelement of the sequence not already processed or being processed byanother worker core.
 3. The method of claim 1, wherein beginningprocessing the sequence comprises requesting and processing apredetermined number of element of the sequence so as to reducesynchronization overhead, the elements not already processed or beingprocessed by another worker core.
 4. The method of claim 1, wherein thesequence is a lazy sequence.
 5. The method of claim 1, wherein thesequence is a lazy locked sequence.
 6. The method of claim 1, furthercomprising merging results of processing the sequence by the workercores.
 7. The method of claim 6, wherein merging the results comprisesmerging the results in a fashion that preserves ordering of sequenceelements.
 8. In a computing environment a system for partitioning queryexecution work of a sequence comprising a plurality of elements, thesystem comprising: a plurality of processor cores; computer memorycoupled to the plurality of processor cores, wherein the computer memorycomprises computer executable instructions that when executed by one ormore of the plurality of processor cores, causes the following: (a) aworker core requesting work from a work queue; (b) in response, theworker core receiving a task from the work queue, the task being areplicable sequence-processing task comprising two distinct steps,including a subtask of scheduling a copy of the task on the schedulerqueue and a subtask of processing a sequence; (c) the worker coreprocessing the task by: creating a replica of the task and placing thereplica of the task on the work queue, wherein the replica of the taskis a replicable sequence-processing task comprising two distinct steps,including a subtask of scheduling a copy of the replica of the task onthe scheduler queue and a subtask of processing a sequence; andbeginning processing the sequence; and (d) repeating acts (a)-(c) forone or more additional worker cores, wherein act (b) for the one or moreadditional worker cores is performed by receiving one or more replicasof tasks placed on the task queue by earlier performance of act (c) byone or more different worker cores.
 9. The system of claim 8, whereinbeginning processing the sequence comprises requesting and processing asingle element of the sequence not already processed or being processedby another worker core.
 10. The system of claim 8, wherein beginningprocessing the sequence comprises requesting and processing apredetermined number of element of the sequence so as to reducesynchronization overhead, the elements not already processed or beingprocessed by another worker core.
 11. The system of claim 8, wherein thesequence is a lazy sequence.
 12. The system of claim 8, wherein thesequence is a lazy locked sequence.
 13. The system of claim 8, furthercomprising merging results of processing the sequence by the workercores.
 14. The system of claim 13, wherein merging the results comprisesmerging the results in a fashion that preserves ordering of sequenceelements.
 15. In a computing environment comprising multiple processorcores, a physical non-transitory computer readable medium comprisingcomputer executable instructions stored on the physical non-transitorycomputer readable medium that when executed by one or more computerprocessor cores cause the one or more processor cores to perform thefollowing: (a) a worker core requesting work from a work queue; (b) inresponse, the worker core receiving a task from the work queue, the taskbeing a replicable sequence-processing task comprising two distinctsteps, including a subtask of scheduling a copy of the task on thescheduler queue and a subtask of processing a sequence; (c) the workercore processing the task by: creating a replica of the task and placingthe replica of the task on the work queue, wherein the replica of thetask is a replicable sequence-processing task comprising two distinctsteps, including a subtask of scheduling a copy of the replica of thetask on the scheduler queue and a subtask of processing a sequence; andbeginning processing the sequence by processing one or more elements ofthe sequence by calling a subroutine that returns one or more of theelements of the sequence, where subsequent calls of the subroutinereturn one or more next logical elements of the sequence that have notalready been returned in response to calling the subroutine; (d)repeating acts (a)-(c) for one or more additional worker cores, whereinact (b) for the one or more additional worker cores is performed byreceiving one or more replicas of tasks placed on the task queue by anearlier performance of act (c) by one or more different worker core andwherein act (c) is performed by the one or more additional cores bycalling the subroutine so as to receive elements of the sequence thatare to be the next logically processed elements that have not alreadybeen processed; and merging results of processing the sequence by theworker cores.
 16. The computer readable medium of claim 15, whereinbeginning processing the sequence comprises requesting and processing asingle element of the sequence not already processed or being processedby another worker core.
 17. The computer readable medium of claim 15,wherein beginning processing the sequence comprises requesting andprocessing a predetermined number of element of the sequence so as toreduce synchronization overhead, the elements not already processed orbeing processed by another worker core.
 18. The computer readable mediumof claim 15, wherein the sequence is a lazy sequence.
 19. The computerreadable medium of claim 15, wherein the sequence is a lazy lockedsequence.
 20. The computer readable medium of claim 15, wherein mergingthe results comprises merging the results in a fashion that preservesordering of sequence elements.